import { defineStore } from "pinia";
import { logout } from "@/apis/login";
import { microAppMainRouter } from "@/microApp";

const useUserStore = defineStore("user", {
  state: () => ({
    userInfo: {},
    roles: [],
    permissions: []
  }),
  actions: {
    crmLogOut() {
      return new Promise( async() => {
        await logout();
        microAppMainRouter("replace", { path: "/login" });
      });
    }
  }
});

export default useUserStore;
